package com.windystory.app.antdesign;

import android.os.Handler;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.windystory.wslibrary.base.activity.BaseActivity;
import com.windystory.wslibrary.ui.update.VersionUpgradeDialog;
import com.windystory.wslibrary.ui.imageview.ImageViewX;

public class TestActivity extends BaseActivity {

    @Override
    public int getLayoutRes() {
        return R.layout.activity_test;
    }

    @Override
    protected boolean setEnableSwipeBack() {
        return false;
    }

    @Override
    protected void initView() {
        ImageView img = (ImageView) findViewById(R.id.img);
        ImageView img2 = (ImageView) findViewById(R.id.img2);
        ImageViewX.setImageCircle(this, R.drawable.pro, R.drawable.pro, img);

        ImageViewX.setImageRoundedCorners(this, R.drawable.pro, R.drawable.pro,
                img2, 15);
    }

    @Override
    protected void initData() {
        // VideoPlayActivity.startActivity(this, "rtmp://live.hkstv.hk.lxdns.com/live/hks", "测试", "");

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                VersionUpgradeDialog versionUpgradeDialog = new VersionUpgradeDialog(TestActivity.this, "标题", "框架内部支持中/英文 国际化\n" +
                        "查看版本库中的Log只需要过滤AppUpdate开头的Tag\n" +
                        "支持校验安装包的MD5避免重复下载，只需要DownloadManager设置安装包的MD5即可\n",
                        false, "xyt.apk", "https://alicdn.xyt360.com.cn/apk/XYTapp2.3.200408.apk",
                        R.mipmap.ic_launcher);
                versionUpgradeDialog.show(versionUpgradeDialog);
            }
        }, 1000 * 5);
    }

    @Override
    protected void initListener() {
        findViewById(R.id.blue).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                readyGo(SocketDemoActivity.class);
                Toast.makeText(TestActivity.this, "11231231", Toast.LENGTH_SHORT).show();
            }
        });
    }

    /**
     * 无网
     */
    public void withOutNetWork() {
        Toast.makeText(this, "withOutNetWork", Toast.LENGTH_SHORT).show();
    }

    /**
     * 有移动网
     */
    public void withMobileNetWork() {
        Toast.makeText(this, "withMobileNetWork", Toast.LENGTH_SHORT).show();
    }

    /**
     * 有wifi网
     */
    public void withWiFiNetWork() {
        Toast.makeText(this, "withWiFiNetWork", Toast.LENGTH_SHORT).show();
    }


    /**
     * 移动网转WIFI网
     */
    public void withMobile2WiFiNetWork() {
        Toast.makeText(this, "withMobile2WiFiNetWork", Toast.LENGTH_SHORT).show();
    }

}
